#include <iostream>
using namespace std;

int find(string s1,string s2)
{
    int mmax = 0;
    for(int i = 0;i < s1.size() && i + s2.size() <= s1.size();i++)
    {
        int sum = 0;
        for(int j = 0,k = i;j < s2.size();j++,k++)
        {
            if(s1[k] == s2[j])
            {
                sum++;
            }
        }
        mmax = max(mmax,sum);
    }
    return mmax;
}

int main() {
    string s1,s2;
    cin >> s1 >> s2;
    int ans = find(s2,s1);
    cout << s1.size() - ans << endl;
    return 0;
}
// 64 位输出请用 printf("%lld")